<%@page import="com.thinktank.dao.BoardDao"%>
<%@page import="com.thinktank.vo.Board"%>

<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html >
<html>
<head>
	<title>게시판</title>
<style type="text/css">

#board_intro {
	padding: 0 0 20px; 
	margin: 0 0 10px;
	border-bottom: 1px dotted #ddd; 
}

h1 {
	 font-weight: normal;
	 margin-top: -5px;
	 font-size: 1.9em; 
	 color: #000;
}

#board_introsub {
	font: .8em Arial, Verdana, Tahoma, Sans-Serif; 
	color: #555;
}

#board_hide {
	font: .9em Arial, Verdana, Tahoma, Sans-Serif; 
}

#search {
	text-align: right;
	margin-bottom: 10px;
	font: .9em Arial, Verdana, Tahoma, Sans-Serif; 
}

#board_write {
	border: 0;
	background-color: #f4f4f4;
}

table {
	margin: auto;
	width: 680px;
	text-align: center;
	font: .9em Arial, Verdana, Tahoma, Sans-Serif; 
	color: #555;
}

.board_list_menu {
	border-bottom: 1px dotted #999;
	height: 40px;
}

.board_list_content {
	border-bottom: 1px dotted #999;
}

#board_list_sub {
	text-align: left;
}

#board_page {
	text-align: center;
}

a {
	text-align:center;
	text-decoration: none;
	color:#555;
}

a:hover{
	font-weight: bold;
}

		
</style>

<script type="text/javascript">
function setIFrameHeight(obj){
    if(obj.contentDocument){
        obj.height = obj.contentDocument.body.offsetHeight + 250;
    } else {
        obj.height = obj.contentWindow.document.body.scrollHeight;
    }
}

window.onload = function() {
	var show = document.getElementById("board_list");
	var board_write = document.getElementById("board_write");
	board_write.onmouseover = function() {
		board_write.style.cursor = "pointer";
		board_write.style.fontWeight = "bold";
		board_write.onmouseout = function() {
			board_write.style.fontWeight = "normal";
		};
	};
	show.style.display = "none";
	myDisplay();
};
	
function myDisplay() {
	var reply_click = document.getElementById("board_hide");
	var reply_show = document.getElementById("board_list");
	reply_click.onclick = function toggle() {
	    if (reply_show.style.display == 'none') {
	    	reply_show.style.display='block';
	    }
	    else {
	    	reply_show.style.display='none';
	    }
	};
};
</script>
</head>
<body>
	<div id="board_wrapper">
		<div id="board_intro">
			<h1>
				<a href="board.do">BOARD</a>
			</h1>
		</div>
		<a href="#" id="board_hide">Board List &nbsp;[Show & Hide] &nbsp;↕</a>
		<div id="board_list">
			<div id="search">
				<form action="board.do" method="post">
					<input type="hidden" name="pg" value="1" />
					<select name="field" >	
						<option value="BD_SUBJECT">제목</option>
						<option value="BD_CONTENT">내용</option>										
					</select>
					<input type="text" name="query" width=1>
					<input type="submit" value="검 색" id="board_write" />&nbsp;&nbsp;|&nbsp;&nbsp;
					<c:if test="${ member.mPage == url }"><a href="boardReg.jsp" target="_self">글쓰기</a></c:if>
				</form>							
			</div>
			<table>
				<tr>
					<td width="80%" class="board_list_menu" align="left">게시글 목록</td>
					<td width="5%" class="board_list_menu">댓글</td>
					<td width="15%" class="board_list_menu">날짜</td>
				</tr>
				<c:forEach var="n" items="${list }" >
				<tr>		
					<td width="80%" class="board_list_content" id="board_list_sub"><a href="boardDetail.do?bNo=${n.bNo}" target="iname" >&nbsp;&nbsp;&nbsp;&nbsp;ㆍ ${n.bSubject}</a></td>				
					<td width="5%" class="board_list_content">${n.bSub}</td>
					<td width="15%" class="board_list_content">${n.bDate}</td>
				</tr>				
				</c:forEach>
			</table>
			<div id="board_page">
				&lt;<c:forEach var="i" begin="1" end="${ count }">
					<a href="board.do?pg=${ i }">&nbsp;${ i }&nbsp;</a>
				</c:forEach>&gt;
			</div>
		</div>
		<div id="board_content">		
			<c:choose>
				<c:when test="${ getbNo ==null }">
					<iframe id=inner1 name=iname width=100% scrolling=no frameborder=0 src='boardDetail.do?bNo=${list[0].bNo}' onLoad="setIFrameHeight(this)"></iframe>
				</c:when>
				<c:otherwise>
					<iframe id=inner1 name=iname width=100% scrolling=no frameborder=0 src='boardDetail.do?bNo=${ getbNo }' onLoad="setIFrameHeight(this)"></iframe>
				</c:otherwise>
			</c:choose>
		</div>
	</div>

</body>
</html>